package com.travel.controller.admin;

import com.travel.model.dto.common.ApiResponse;
import com.travel.model.dto.service.AuditDTO;
import com.travel.model.dto.service.ServiceDTO;
import com.travel.service.Service.TravelService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
//管理员服务管理接口 , 获取所有服务, 审核服务
@Tag(name = "管理员服务", description = "管理员服务管理接口")
@RestController
@RequestMapping("/api/admin/services")
@RequiredArgsConstructor
public class AdminServiceController {
    private final TravelService travelService;

    @Operation(summary = "获取所有服务")
    @GetMapping
    public ApiResponse<Page<ServiceDTO>> getAllServices(
            @Parameter(description = "分页参数") Pageable pageable) {
        return ApiResponse.success("获取成功", travelService.getAllServices(pageable));
    }

    @Operation(summary = "审核服务")
    @PutMapping("/{id}/audit")
    public ApiResponse<Void> auditService(
            @Parameter(description = "服务ID", required = true) @PathVariable Long id,
            @Parameter(description = "审核信息", required = true) 
            @Valid @RequestBody AuditDTO auditDTO) {
        travelService.auditService(id, auditDTO);
        return ApiResponse.success("审核成功");
    }
} 